/**
 * Represents a movie with a title, year, director, synopsis, and rating.
 * @author mmuppa and klw4z
 *
 */
public class Movie {
	private String movieTitle;
	private int movieYear;
	private String movieDirector;
	private String movieSynopsis;
	private int movieRating;
	
	
	/**
	 * Initialize the movie parameters.
	 * @param movieTitle
	 * @param movieYear
	 * @param movieDirector
	 * @param movieSynopsis
	 * @param movieRating
	 * @throws IllegalArgumentException if title or genre or studio name are null or empty,
	 * length <= 0, year < 1920.
	 */
	public Movie(String title, int year, String director, String synopsis,
			int rating) {
		setTitle(title);
		setYear(year);
		setDirector(director);
		setSynopsis(synopsis);
		setRating(rating);
	}
	
	public Movie(String title, int Year) {
		setTitle(title);
		setYear(Year);
	}
	@Override
	public String toString()
	{
		return "Movie [title=" + movieTitle + ", year=" + movieYear + ", director="
				+ movieDirector + ", synopsis=" + movieSynopsis + ", rating=" + movieRating
				+ "]";
	}

	/**
	 * Returns the title of the movie.
	 * @return movie title
	 */
	public String getTitle()
	{
		return movieTitle;
	}
	
	/**
	 * Modifies the title of the movie.
	 * @param title
	 * @throws IllegalArgumentException if title is null or empty.
	 */
	public void setTitle(String title)
	{
		if (title == null || title.length() == 0 )
			throw new IllegalArgumentException("Please supply a valid title.");
		this.movieTitle = title;
	}
	
	/**
	 * Returns the year the movie was made.
	 * @return year
	 */
	public int getYear()
	{
		return movieYear;
	}
	
	/**
	 * Sets the movie year.
	 * @param year
	 * @throws IllegalArgumentException if year is before 1920. 
	 */
	public void setYear(int year)
	{
		if (year < 1850)
			throw new IllegalArgumentException("Movie year cannot be before 1950.");
		this.movieYear = year;
	}
	
	/**
	 * Returns the director of the movie.
	 * @return movieDirector
	 */
	public String getDirector()
	{
		return movieDirector;
	}
	
	/**
	 * Modifies the director of the movie.
	 * @param dir
	 * @throws IllegalArgumentException if director is negative or 0.
	 */
	public void setDirector(String dir)
	{
		if (dir == null || dir.length() == 0 )
			throw new IllegalArgumentException("Please supply a valid director.");
		this.movieDirector = dir;
	}
	
	/**
	 * Returns the synopsis of the movie.
	 * @return movieSynopsis
	 */
	public String getSynopsis()
	{
		return movieSynopsis;
	}
	
	/**
	 * Sets the synopsis of the movie.
	 * @param synopsis
	 */
	public void setSynopsis(String synopsis)
	{
		this.movieSynopsis = synopsis;
	}
	
	/**
	 * Returns the movie's rating.
	 * @return movieRating
	 */
	public int getRating()
	{
		return movieRating;
	}
	
	/**
	 * Sets the movie's rating. 
	 * @param rating
	 */
	public void setRating(int rating)
	{
		this.movieRating = rating;
	}
	
	
}

